home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_minesftydoors.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  274 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_MineSftyDoors.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.     message     startup
  13.     message     user0
  14.     message     user1
  15.     message     user2
  16.     message     entered
  17.     message     activated
  18.     message     blocked
  19.  
  20.     thing       car             local
  21.     thing       player          local
  22.     thing       doorL                              
  23.     thing       doorR
  24.     sector      doorSector      nolink
  25.  
  26.     surface     open            mask=0x404
  27.     surface     close           mask=0x404
  28.     surface        stopface            
  29.     
  30.     sound       sndOpen=sol_cardoor_open_c.wav      local
  31.     sound       sndClose=sol_cardoor_close_c.wav    local
  32.     
  33.     sound       in_Line0=Pr15j02.wav        local   # The fire door only opens...
  34.     sound       in_Line1=Inxj096.wav        local   # I can't open it.
  35.     sound        fireSafety=pr15j01.wav        local   # Horner must have been worried...
  36.     
  37.     vector      color           local
  38.     
  39.     flex        R=0.3
  40.     flex        G=0.3
  41.     flex        B=0.35
  42.     
  43.     int         doorsOpen=0        local
  44.     int         sender            local
  45.     int         sound1          local
  46.     int         newComment      local
  47.     int         oldComment      local
  48.     int         playing=0       local
  49.     
  50.     int         override=0      local
  51.     int         doorsMoving=0   local
  52.     int         chase1Wait=0    local
  53.     int         count=0         local
  54.  
  55.     # ** Subroutines **
  56.     flex        openDoors       local
  57.     flex        closeDoors      local
  58.     flex        doorLine        local
  59.         
  60. end
  61.  
  62. # ========================================================================================
  63. code
  64.  
  65. startup:
  66.  
  67.     SectorAdjoins(doorSector, 0);
  68.     color = VectorSet(R, G, B);
  69.     SetThingLight(doorL, color, 0.001, 0.1);
  70.     SetThingLight(doorR, color, 0.001, 0.1);
  71.     
  72.     return;
  73.         
  74. # ========================================================================================
  75.  
  76. user0:
  77.  
  78.     override = 1;
  79.     call openDoors;
  80.     return;
  81.     
  82. # ========================================================================================
  83.  
  84. user1:
  85.  
  86.     call closeDoors;
  87.     override = 0;
  88.     return;
  89.     
  90. # ========================================================================================
  91.  
  92. user2:
  93.  
  94.     chase1Wait = 1;
  95.     return;
  96.     
  97. # ========================================================================================
  98.       
  99. entered:
  100.         
  101.     sender = GetSenderRef();
  102.     car = GetSourceRef();
  103.  
  104.     if((BitTest(GetPhysicsFlags(car), 0x01000000)) && (!doorsMoving) && (!override))
  105.     {
  106.         if((sender == open) && (!doorsOpen))
  107.         {
  108.             call openDoors;    
  109.         }
  110.         
  111.         else if((sender == close) && (doorsOpen))
  112.         {
  113.             call closeDoors;
  114.         }
  115.     }
  116.         
  117.     return;
  118.  
  119. # ========================================================================================
  120.  
  121. activated:
  122.  
  123.     Print("Activated: Mine Doors");
  124.     player = GetLocalPlayerThing();
  125.  
  126.     if((GetSenderRef() == doorL) || (GetSenderRef() == doorR))
  127.     {
  128.         if(playing == 0) Call doorLine;
  129.     }
  130.  
  131.     return;
  132.  
  133. # ========================================================================================
  134.  
  135. openDoors:
  136.  
  137.     doorsMoving = 1;
  138.     # turn on adjoin, remove door collisions
  139.     SectorAdjoins(doorSector, 1);
  140.     SetCollideType(doorL, 0);
  141.     SetCollideType(doorR, 0);
  142.     
  143.     # play door sounds
  144.     if(doorsOpen == 0)
  145.     {
  146.         sound1 = PlaySoundThing(sndOpen, doorL, 0.75, 15.0, 30.0, 0);
  147.         Sleep(0.02);
  148.         PlaySoundThing(sndOpen, doorR, 0.75, 15.0, 30.0, 0);
  149.     }
  150.     
  151.     # open the doors
  152.     MoveToFrame(doorL, 1, 2.2);
  153.     MoveToFrame(doorR, 1, 2.2);
  154.     #WaitForStop(doorL);
  155.     doorsOpen = 1;
  156.     doorsMoving = 0;
  157.     SetSurfaceFlags(stopface, 0x4000);
  158.  
  159.     return;
  160.  
  161. # ========================================================================================
  162.  
  163. closeDoors:
  164.  
  165.     doorsMoving = 1;
  166.     
  167.     WaitForStop(doorL);
  168.     WaitForSound(sound1);
  169.     
  170.     if(chase1Wait == 1)
  171.     {
  172.         Print("MineSftyDoors: waiting");
  173.         Sleep(5.0);
  174.         chase1Wait = 0;
  175.     }
  176.     
  177.     SetCollideType(doorL, 3);
  178.     SetCollideType(doorR, 3);
  179.     
  180.     # play door sounds
  181.     PlaySoundThing(sndClose, doorL, 0.75, 15.0, 30.0, 0);
  182.     Sleep(0.02);
  183.     PlaySoundThing(sndClose, doorR, 0.75, 15.0, 30.0, 0);
  184.     
  185.     # close the doors
  186.     MoveToFrame(doorL, 0, 1.6);
  187.     MoveToFrame(doorR, 0, 1.6);
  188.     
  189.     ClearSurfaceFlags(stopface, 0x4000);
  190.  
  191.     # turn off adjoin, reset collisions
  192.     WaitForStop(doorL);
  193.     
  194.     #SetCollideType(doorL, 3);
  195.     #SetCollideType(doorR, 3);
  196.     
  197.     Sleep(1.0);
  198.     SectorAdjoins(doorSector, 0);
  199.     doorsOpen = 0;
  200.     doorsMoving = 0;
  201.  
  202.     return;
  203.     
  204. # ========================================================================================
  205.  
  206. doorLine:
  207.  
  208.     playing = 1;
  209.     
  210.     while (newComment == oldComment) 
  211.     {
  212.         newComment = RandBetween(0, 1);
  213.     }
  214.     
  215.     oldComment = newComment;
  216.     
  217.     count = count + 1;
  218.     
  219.     # do cutscene stuff
  220.     MakeMeStop();
  221.     StartCutscene(0);
  222.     
  223.     # offset camera and nudge the door
  224.     SetExtCamOffset('0.1 0.0 0.065');
  225.     
  226.     # put away any weapon
  227.     DeselectWeaponWait(player);
  228.     
  229.     PlayMode(player, 60, 0);
  230.     Sleep(0.3);
  231.     
  232.     # player never activated door in PYR
  233.     if(global12 == 0)
  234.     {
  235.         PlayVoice(player, fireSafety, 1.0, 1);
  236.         global12 = 1;
  237.     }
  238.     
  239.     # player activated door in PYR
  240.     else if(global12 == 1)
  241.     {
  242.         if(count == 5)
  243.         {
  244.             count = 0;
  245.             PlayVoice(player, fireSafety, 1.0, 1);
  246.         }
  247.         
  248.         else
  249.         {
  250.             PlayVoice(player, in_Line0[newComment], 1.0, 1);
  251.         }
  252.     }
  253.     
  254.     RestoreExtCam();
  255.     ClearActorFlags(player, 0x200000);
  256.     EndCutscene();
  257.     
  258.     playing = 0;
  259.     
  260.     return;
  261.     
  262. # ========================================================================================
  263.  
  264. blocked:
  265.  
  266.     Print("blocked");
  267.     Call openDoors;
  268.     return;
  269.     
  270. # ========================================================================================
  271.  
  272. end
  273.  
  274.